package com.mac.hosp_pre.admin.model.req;

import cn.hutool.json.JSONUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.List;

/**
 * 预约规则
 *
 * @author mac
 */
@Schema(name = "预约规则")
@Data
public class PreBookRuleDto implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 预约周期
	 */
	@Schema(description = "预约周期")
	private Integer cycle;

	/**
	 * 放号时间
	 */
	@Schema(description = "放号时间")
	private String releaseTime;

	/**
	 * 停挂时间
	 */
	@Schema(description = "停挂时间")
	private String stopTime;

	/**
	 * 退号截止天数（如：就诊前一天为-1，当天为0）
	 */
	@Schema(description = "退号截止天数（如：就诊前一天为-1，当天为0）")
	private Integer quitDay;

	/**
	 * 退号时间
	 */
	@Schema(description = "退号时间")
	private String quitTime;

	/**
	 * 预约规则
	 */
	@Schema(description = "预约规则")
	private List<String> rule;
	

	public void setRule(String rule) {
		if(!StringUtils.isEmpty(rule)) {
			this.rule = JSONUtil.toList(rule, String.class);
		}
	}

}

